// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.worldMap.markers;

import java.util.ArrayList;
import zombie.util.Pool;
import zombie.worldMap.UIWorldMap;

public final class WorldMapMarkers {
    private static final Pool<WorldMapGridSquareMarker> s_gridSquareMarkerPool = new Pool<>(WorldMapGridSquareMarker::new);
    private final ArrayList<WorldMapMarker> m_markers = new ArrayList();

    public WorldMapGridSquareMarker addGridSquareMarker(int worldX, int worldY, int radius, float r, float g, float b, float a) {
        WorldMapGridSquareMarker worldMapGridSquareMarker = s_gridSquareMarkerPool.alloc().init(worldX, worldY, radius, r, g, b, a);
        this.m_markers.add(worldMapGridSquareMarker);
        return worldMapGridSquareMarker;
    }

    public void removeMarker(WorldMapMarker marker) {
        if (this.m_markers.contains(marker)) {
            this.m_markers.remove(marker);
            marker.release();
        }
    }

    public void clear() {
        for (int _int = 0; _int < this.m_markers.size(); _int++) {
            ((WorldMapMarker)this.m_markers.get(_int)).release();
        }

        this.m_markers.clear();
    }

    public void render(UIWorldMap ui) {
        for (int _int = 0; _int < this.m_markers.size(); _int++) {
            ((WorldMapMarker)this.m_markers.get(_int)).render(ui);
        }
    }
}
